package com.turing.post.cardmanagement.util;

import java.io.Serializable;

import javax.naming.InitialContext;

import com.turing.post.util.PCPSApplicationException;

/**
 * @author zxp
 * @Apr 11, 2013
 */
@SuppressWarnings("serial")
public class AppManTranBusinessAgent implements Serializable {

	private static final AppManTranBusiness getAppManTranBusinessByAppManagement(
			AppManagement amg) throws PCPSApplicationException {
		try {
			InitialContext ctx = new InitialContext();
			AppManTranBusiness btb = (AppManTranBusiness) ctx.lookup(amg
					.getJndiName()
					+ "#" + AppManTranBusiness.class.getName());
			return btb;
		} catch (Exception ex) {
			throw new PCPSApplicationException("", "实现类未找到!");
		}
	}

	/**
	 * 卡发行预处理
	 */
	public static final Object AppCardIssuePre(AppManagement am, String cardNo,
			Object privobj) throws PCPSApplicationException {
		return getAppManTranBusinessByAppManagement(am).AppCardIssuePre(am,
				cardNo, privobj);
	}

	/**
	 * 卡发行后处理
	 */
	public static final void AppCardIssuePost(AppManagement am, String cardNo,
			Object privobj) throws PCPSApplicationException {
		getAppManTranBusinessByAppManagement(am).AppCardIssuePost(am, cardNo,
				privobj);
	}

	/**
	 * 卡特殊业务处理
	 */
	public static final void AppCardSpecial(AppManagement am, String cardNo,
			String tranType, Object privobj) throws PCPSApplicationException {
		getAppManTranBusinessByAppManagement(am).AppCardSpecial(am, cardNo,
				tranType, privobj);
	}
}
